{template nheader.html}
<link href="{THEME_PATH}admin/global/css/admin_style.css" rel="stylesheet"  />
<script>
    $(function(){

        $("#dr_num").focusout(function(){
            num = $("#dr_num").val();
            if(!(/[0-9]/.test(num))){
                alert("请填写数字");
                return false;
            }
        });
        $("#dr_price").focusout(function(){
            num = $("#dr_price").val();
            if(!(/[0-9]/.test(num))){
                alert("请填写数字");
                return false;
            }
        });

        $(".add_course").click(function(){
            var stage = $("select[name='stage']").val(),
                subject = $("select[name='subject']").val(),
                type = $("select[name='type']").val(),
                price = $("#dr_price").val(),
                num = $("#dr_num").val(),
                course_name = $("#dr_course_name").val();
            if(!stage){
                alert("阶段不能为空");
                return false;
            }
            if(!subject){
                alert("学科不能为空");
                return false;
            }
            if(!type){
                alert("类型不能为空");
                return false;
            }
            if(!price){
                alert("单价不能为空");
                return false;
            }
            if(!num){
                alert("数量不能为空");
                return false;
            }
            if(!course_name){
                alert("课程名称不能为空");
                return false;
            }
            var str = stage+','+subject+','+type+','+price+','+num+"#";
            var see_str = '<div class="select_class_list"><span class="type">'+type+'</span>/<span class="stage">'+stage+'</span>/<span class="subject">'+subject+'</span><span class="price">单价：<span>'+price+'</span></span><span class="num">数量：</span>'+num+'</div>';
            var couserse = $("#dr_course").val();
            var see_couserse = $(".order-data").html();
            if(!couserse){
                $("#dr_course").val(str);
                $(".order-data").html(see_str);
            }else{
                $("#dr_course").val(couserse+str);
                $(".order-data").html(see_couserse+see_str);
            }

            return true;
        });
        $(".green").click(function(){
            var name = $("#dr_name").val(),
                mobile = $("#dr_mobile").val(),
                couserse = $("#dr_course").val();
            if(!name){
                alert('姓名不能为空');
                return false;
            }
            if(!mobile){
                alert('手机号码不能为空');
                return false;
            }

            if(!couserse){
                alert('添加课程不能为空');
                return false;
            }
            return true;

        });
    });
</script>
<form class="form-horizontal le_enter_order" action="" method="post" id="myform" name="myform" style="margin-top:30px;margin-bottom: 70px;">
    <div class="portlet light bordered">

        <div class="portlet-title">
            <div class="caption">
                <span class="caption-subject font-green bold uppercase"><span style='font-family: "FontAwesome";'></span> {$name}</span>
            </div>
        </div>
        <div class="portlet-body">
            <div class="portlet-body form">
                <div class="form-body">
                    <div class="le_2_col box_required">
                        <div class="form-group leisure_2_1_col ">
                            <label class="col-md-2 control-label"><span class="required">*</span>{fc_lang('用户姓名')}：</label>
                            <div class="col-md-9">
                                <label>{dr_field_input('name','Text', $field['name']['setting'], $data['name'])}</label>
                            </div>
                        </div>
                        <div class="form-group leisure_2_2_col">
                            <label class="col-md-2 control-label"><span class="required">*</span>{fc_lang('用户手机号')}：</label>
                            <div class="col-md-9">
                                <div class="radio-list">
                                    <label>{dr_field_input('mobile', 'Text', $field['mobile']['setting'], $data['mobile'])}</label>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="class_box">
                        <div class="box_title box_required"><span class="required">*</span>课程信息：</div>
                        <div class="class_message">
                            <div class="le_3_col message_top">
                                <div class="form-group leisure_3_1_col">
                                    <label class="col-md-2 control-label">{fc_lang('阶段')}：</label>
                                    <div class="col-md-9">
                                        <label>
                                            <select class="form-control" name="stage">
                                                <option value="">请选择</option>
                                                {loop $stages $key $vals}
                                                    <option value="{$vals}">{$vals}</option>
                                                {/loop}
                                            </select>
                                        </label>
                                    </div>
                                </div>
                                <div class="form-group leisure_3_2_col ">
                                    <label class="col-md-2 control-label">{fc_lang('学科')}：</label>
                                    <div class="col-md-9">
                                        <label>
                                            <select class="form-control" name="subject">
                                                <option value="">请选择</option>
                                                {loop $subjects $k $sub}
                                                <option value="{$sub}">{$sub}</option>
                                                {/loop}
                                            </select>
                                        </label>
                                    </div>
                                </div>
                                <div  class="form-group leisure_3_3_col " >
                                    <label class="col-md-2 control-label">{fc_lang('类型')}：</label>
                                    <div class="col-md-9">
                                        <label>
                                            <select class="form-control" name="type">
                                                <option value="">请选择</option>
                                                {loop $types $ke $t}
                                                <option value="{$t}">{$t}</option>
                                                {/loop}
                                            </select>
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="le_2_col message_middle">
                                <div class="form-group leisure_2_1_col">
                                    <label class="col-md-2 control-label">{fc_lang('课程名称')}：</label>
                                    <div class="col-md-9">
                                        <label>
                                            {dr_field_input('course_name','Text',$field['course_name']['setting'], $data['course_name'])}
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="le_2_col message_middle">
                                <div class="form-group leisure_2_1_col">
                                    <label class="col-md-2 control-label">{fc_lang('单价')}：</label>
                                    <div class="col-md-9">
                                        <label>
                                            {dr_field_input('price','Text',$field['price']['setting'], $data['price'])}
                                        </label>
                                    </div>
                                </div>
                                <div class="form-group leisure_2_2_col">
                                    <label class="col-md-2 control-label">{fc_lang('数量')}：</label>
                                    <div class="col-md-9">
                                        <label>
                                            {dr_field_input('num','Text',$field['num']['setting'], $data['num'])}
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group message_bottom">
                                <label class="col-md-2 control-label"><a class="add_course">{fc_lang('添加课程')}</a></label>
                                <div class="col-md-9" style="display:none;">
                                    <div class="radio-list">
                                        <label>{dr_field_input('course', 'TextArea',$field['course']['remark'], $data['course'])}</label>
                                    </div>
                                </div>
                                <label class="col-md-2 control-label original-add">{fc_lang('已添加')}：</label>
                                <div class="order-data"></div>
                            </div>
                        </div>
                    </div>

                    <div class="form-group ">
                        <label class="col-md-2 control-label">{fc_lang('备注')}：</label>
                        <div class="col-md-9">
                            <div class="radio-list">

                                <label>{dr_field_input('remark', 'TextArea',$field['mobile']['remark'], $data['remark'])}</label>
                            </div>
                        </div>
                    </div>

                </div>
            </div>

        </div>
    </div>

    <div class="myfooter">
        <div class="row">
            <div class="portlet-body form">
                <div class="form-body">
                    <div class="form-actions">
                        <div class="row">
                            <div class="col-md-12 text-center">
                                <button type="submit" class="btn green"> <i class="fa fa-save"></i> {fc_lang('保存')}</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>

{template nfooter.html}